package arch.coal.ellipse.security.tables;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;

import org.apache.log4j.Logger;

import arch.coal.ellipse.security.data.MSF170;


public class TableMSF170 extends BasicTable {
	
	private LinkedList dataList;
	static Logger logger = Logger.getLogger(TableMSF170.class);
	
	void populateSqlSelectStmt() {
		sqlSelectStmt.append("SELECT");
		sqlSelectStmt.append(" dstrct_code, stock_code, soh, in_transit,");
		sqlSelectStmt.append(" consign_soh, consign_itrans, total_picked, cLass, ");
		sqlSelectStmt.append(" stock_type, invent_value, invent_cost_pr, last_iss_date,");
		sqlSelectStmt.append(" last_rec_date, stock_at_bin, last_mod_date ");
		sqlSelectStmt.append("FROM MSF170 ");
	}
	
	void setTableName(String table) {
		tableName = "MSF170";
	}

	public void processResultSet(ResultSet rs) {
		
		dataList = new LinkedList();
		
		try {
			while ( rs.next() ) {
				MSF170 data = new MSF170();
				data.setDstrct_code(rs.getString(1));
				data.setStock_code(rs.getString(2));
				data.setSoh(rs.getInt(3));
				data.setIn_transit(rs.getInt(4));
				data.setConsign_soh(rs.getInt(5));
				data.setConsign_itrans(rs.getInt(6));
				data.setTotal_picked(rs.getInt(7));
				data.setCLass(rs.getString(8));
				data.setStock_type(rs.getString(9));
				data.setInvent_value(rs.getInt(10));
				data.setInvent_cost_pr(rs.getInt(11));
				data.setLast_iss_date(rs.getString(12));
				data.setLast_rec_date(rs.getString(13));
				data.setStock_at_bin(rs.getString(14));
				data.setLast_mod_date(rs.getString(15));
				
				dataList.add(data);
			}
		} catch (SQLException se) {
			logger.error("EXCEPTION while getting result set", se);
			se.printStackTrace();
		}
	}
	
	public LinkedList getDataList() {
		return dataList;
	}
	
}
